#include "Blocks/BulletBlock.h"

namespace PocketSurvival
{
    static float weaponPowers[3] = {
        80.0f,
        0.0f,
        3.6f};

    static float explosionPressures[3] = {
        0.0f,
        0.0f,
        0.0f};

    void BulletBlock::getCreativeValues(std::vector<int32_t> &blockVec)
    {
        blockVec.push_back(Terrain::MakeBlockValue(Index(), 0, SetBulletType(0, BulletType::MusketBall)));
        blockVec.push_back(Terrain::MakeBlockValue(Index(), 0, SetBulletType(0, BulletType::Buckshot)));
        blockVec.push_back(Terrain::MakeBlockValue(Index(), 0, SetBulletType(0, BulletType::BuckshotBall)));
    }

    float BulletBlock::getExplosionPressure(int32_t value)
    {
        int32_t arrowType = Terrain::ExtractData(value);
        if (arrowType < 0 || arrowType >= (sizeof(explosionPressures) / sizeof(explosionPressures[0])))
        {
            return 0.0f;
        }
        return explosionPressures[arrowType];
    }

    float BulletBlock::getProjectilePower(int32_t value)
    {
        int32_t arrowType = Terrain::ExtractData(value);
        if (arrowType < 0 || arrowType >= (sizeof(weaponPowers) / sizeof(weaponPowers[0])))
        {
            return 0.0f;
        }
        return weaponPowers[arrowType];
    }

    int32_t BulletBlock::getIndex()
    {
        return Index();
    }
    const std::string &BulletBlock::getBlockName()
    {
        static std::string blockName = "BulletBlock";
        return blockName;
    }

} // namespace PocketSurvival
